
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package ec.edu.ups.cidi.siia.plamdep.modelo.analizadorLexico;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Usuario
 */
public class NGrama 
{
   List<Palabra> palabras;
    int numero;
    
    public NGrama(int numero){
        this.numero = numero;
        palabras=new ArrayList<Palabra>();
    }
    
    public void addPalabra(String palabra){
        
       this.palabras.add(new Palabra(palabra) );
    }
    public void addPalabra(Palabra palabra){
        
       this.palabras.add(palabra);
    }
    public String toString(){
        
        String cad = "";
        for( Palabra p: palabras ){
            if(p.getPalabra().equals("")==false)
                cad = cad + p.getPalabra() + " ";
                
        }
        if(cad.length()>0)
        cad = cad.substring(0, cad.length() - 1);
        return cad;
     }
}
